import {createStore} from './woniu-redux'
function  counter(state=0,action) {
    console.log(state,action)
    switch (action.type) {
        case '加机关枪':
            return state+1;break;
        case '减机关枪':
        return state-1;break;
        default:return 10
            break;
    }
}
const store=createStore(counter)
const init=store.getState()
console.log(init)
function listener() {
    const current=store.getState()
    console.log(`现在的机枪${current}`)
}
store.subscribe(listener)
store.dispatch({type:'加机关枪'})
store.dispatch({type:'加机关枪'})
store.dispatch({type:'减机关枪'})

// console.log(store.getState())